<?php
// +----------------------------------------------------------------------
// | Amicool-MVC [ Dynamic Flexible Agile Devlepment]
// +----------------------------------------------------------------------
// | Copyright (c) 2015-2020 http://amicool.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 郡笑笙 <iamzjs@126.com>
// +---------------------------------------------------------------------- 
 require 'BaseController.php';
 class UserController extends BaseController{   
 	function __Construct(){
 		parent::__Construct();
 		$this->model = new UserModel;
 	}
    
     function index() {   
         $list = $this->model->fetchAll(); 
         $this->assign('list' , $list);  
         $this->display();
     }
     function form(){ 
        $this->display();
     }
     function add(){
     	$result = $this->model->add();
     	if($result){
     		redirect('c=user&m=index');
     	}
     	else{
     		$this->form();
     	}
     }  
     function update(){
        $result = $this->model->update();
        if($result){
            redirect('c=user&m=index');
        }
        else{
            $this->form();
        }
     }
     function delete(){
        $result = $this->model->delete();
        if($result){
            echo "删除成功";
            redirect('c=user&m=index');//我删除了?号
        }
        else{
            echo "删除失败";
            redirect('c=user&m=index');
        }
     }
     function mod() {   
         $id = $_GET['id'];
         $one = $this->model->fetchOne($id);  
         $this->assign('one' , $one);  
         $this->display();
     }
}
?>